from alipay import AliPay
from mall import settings

def generate_alipay_handler():
    alipay = AliPay(
        appid=settings.ALIPAY_APPID,
        app_notify_url=None,  # 默认回调url
        app_private_key_path=settings.ALIPAY_APP_PRIVATE_KEY_PATH,
        alipay_public_key_path=settings.ALIPAY_ALIPAY_PUBLIC_KEY_PATH,
        # sign_type="RSA2",  # RSA 或者 RSA2
        sign_type='RSA2',
        debug=settings.ALPAY_DEBUG  # 默认False
    )
    return alipay